<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

        *{
            margin: 0;
            padding: 0;
        }
        ul{
            list-style: none;
        }
        a{
            text-decoration: none;
        }
        .header-c{
            width: 1200px;
            height: 100px;
            background-color: gray;
            margin: 0 auto;
        }
        .nav{
            float: right;
            height: 100%;
        }
        .nav-item{
            position: relative;
            float: left;
            height: 100%;
            line-height: 100px;
        }
        .nav-item a{
            display: block;
            height: 100%;
            color: #fff;
            padding: 0 20px;
        }
        /* 追随线 */
        .nav-item .line{
            position: absolute;
            left: 0;
            bottom: 30px;
            display: none;
            width: 100%;
            height: 2px;
            background-color: orange;
            /* margin 负值 可以实现 */
            /* margin-top: -30px; */
        }
        .nav-item:hover .line{
            display: block;
        }
        .nav-item:hover a{
            color: orange;
        }
        .sub-nav{
            display: none;
        }
        .nav-item:hover .sub-nav{
            display: block;
        }
        .sub-nav .sub-item{
            height: 50px;
            line-height: 50px;
            background-color: gray;
            text-align: center;
        }
        .sub-nav .sub-item a{
            color: #fff;
        }
        .sub-nav .sub-item:hover a{
            color: orange;
        }

        .banner{
            height: 100px;
            background-color: red;
        }
    </style>
</head>
<body>
    <div class="header-c">
        <ul class="nav">
            <li class="nav-item">
                <a href="#">首页</a>
                <span class="line"></span>
            </li>
            <li class="nav-item">
                <a href="#">UI设计</a>
                <span class="line"></span>
            </li>
            <li class="nav-item">
                <a href="#">前端开发</a>
                <span class="line"></span>
                <ul class="sub-nav">
                    <li class="sub-item">
                        <a href="#">HTML</a>
                    </li>
                    <li class="sub-item">
                        <a href="#">HTML</a>
                    </li>
                    <li class="sub-item">
                        <a href="#">HTML</a>
                    </li>
                </ul>
            </li>
            <li class="nav-item">
                <a href="#">不凡说</a>
                <span class="line"></span>
            </li>
        </ul>
    </div>
    <div class="banner">

    </div>
    
</body>
</html>